Skip to main content

Full text of "Sinc Link"

See other formats


TIMEH-SINCLAIR USERS CLUB 
NEWSLETTER 


Toronto, Ontario 


B6146 
PRINTED IN CANADA - : A 


SEPTEMBER 1984 VOL 2/NO.5 


LETTER FROM THE PRESIDENT 


Welcome back from your summer holidays, fellow members. Our 
elections are now in the process of Finding new executive officers 
which will be in the next Newsletter. There are several openings and 
anyone interested in serving an the executive, Please leave your name 


with us. 


I'm looking forward to a continued good year and since I’m 
stepping down as the President, all my best wishes to the new 
President of the Timex-Sinclair Users Club. 

Greg Lloyd 
(President? 


EXECUTIVE OFFICERS 


PRESIDENT: Greg Lloyd 

SECRETARY! George Chambers 

LIBRARIAN: Martin Nauk 

TREASURER: YJosn Roach 

NEUS EDITOR: tan Piotrowski 

ACTIVITY DIRECTORS: Zrian Hammond, Ian Roberts 
LIASON OFFICER: (Out-of-town members): Chris Hart 


EDITOR’S NOTE 


Again, I am asking for articles to be printed up in the Newsletter. As 
I've said before, it doesn’t matter how trivial it may seem to you, 
Pass it on to your Newsletter and have it printed. Remember, there are 
Many new programmers out there who may have been struggling with the 
sare problem you might have had and couldn't find the solution. By 
Barsing oan these little bits of information, you may be helping 
another +tellow club member. Also, you get to see your name in print 
and if anyone should ask, you can truthfully say that you have had 
some of your computer work published! '! 3 


Stan Pictrawski 
(News Editor) 


BASIC PROGRAMMING 
Well here we are again ready to do some more Basic Programming. 
In this issue, we will use some Hints & Techniques in order to enhance 


or make your Basic programming better. 


Let’s start off with the number of lines you are able to print 
onto your screen. Tha manual tells you that you can only print 22 


PAGE 2 


lines (9 to 21) yet it tells you that the display file or the screen 
size is 32 across by 24 lines down (8 to 23). We actually do have 
access to this but there are 2 restrictions: we cannot print to 24 
lines if there is an INPUT command or a SCROLL command. Otherwise, you 
can. The ZX-81 have several addresses in your RAM pack that it uses 
for itself and if you’re not careful in POKEing these addresses, the 
computer can lock up or go into that wonderful display of a "blizzard 
in the middle of winter”. i 


The address that keeps track of the number of lines on your 
screen is 16418. It normally contains "2" counting from the bottom 
line up which means that you cannot print on the bottom two lines. To 
print to the bottom Z lines; POKE 16418,0. Now you can PRINT AT 
23,@5 "HELLO THERE"... BUT!!! you can’t stop ther program theres it 
must continue on. If it stops, you know that you get error codes in 
the bottom left corner. All error codes are printed on line 23 so it 
would wipe out your PRINT statement. Therefore, if you enter something 
like the following lines: 


ig CLS 

28 POKE 16418,9 

38 PRINT AT 18,8; "ENTER A NUMBER" 

4@ IF INKEYS = "" THEN GOTO 48 

S9 LET AS=INKEYS 

62 PRINT AT 23,12;:"YOUR NUMBER IS: "SAS 
78 GOTO 58 


Now, you can add more printing data if you should want more on 
the screen. If you need to use a SCROLL or an INPUT, don't forget to 
POKE  16418,2 before these commands. Of course you can do the opposite 
which can be effective. 


Enter the following program and you can see that the printing 
will stay on the bottom of the screen while you can scroll and input 
anything: 


18 CLS 

23 PRINT AT 21,25 "PRESS ANY KEY TO STOP" 
38 POKE 16418,19 

42 FOR I=g8 TO 255 

45 SCROLL 

S8 PRINT CHRE I 

68 IF INKEYS-"" THEM GOTO 89 
?£ GOTO 198 

88 NEXT I 

99 IF I=255 THEN GOTO 48 

198 POKE 16418,2Z 

118 FAST 

128 CLS 

138 SLOW 

148 STOP 


Have you ever noticed in some programs (especially game programs 
with machine code) that the first line is always "6". You know that if 
you entered a line number with a zero, then nothing would happen; the 


PAGE 3 


ZX-81 refuses to accept it. Fear not; we can also change this too. 
Simply POKE 16318,8. Now list the program and your first line number 
will be a "9", Also notice that you cannot delete this line number. 
For programmers, they sometimes put in their Copyright notice since 
most novice programmers cannot delete or edit it, By simply reversing 
the process, you can insert a line number that you can delete or edit; 
POKE 16518,1 or the same line number as the following line number in 
your program, l 


Whenever a Program had the command PAUSE, did you notice how 
jerky it seems such as PAUSE 388. The reason is that it is "Bit" 
counting the frames on the TV screen. A much smoother effect for 
waiting a period of time is the FOR/NEXT loop such as: 


1898 FOR I = 1 TO 399 
289 NEXT I 


And finally, here's a short program that displays the calendar 
month for any year you choose. For those of you learning to program, 
S^ through line by line and try to determine exactly what and why the 
Program is doing something. For example, in line #248, the numbers 
that represent some of the months is determined to have 31 days. It 
laso checks whether there was a leap year in the year you chose, 


SLOW 
CLS 

PRINT AT 8,25"1. HARDCOPY", "2. SCREENCOPY* 
IF INKEYS<>"1" AND INKEYS<>"2" THEN GOTO 4 
LET P$-"g" 

IF INKEYS="1" THEN LET P$="1" 

PRINT,, 

PRINT "ENTER MONTH (1 TO 12)" 

INPUT M 

PRINT "ENTER YEAR" 

INPUT Y 

FAST 

58 LET D=1 

68 LET MON=M 

?8 LET YEAR=Y 

89 DIM A$(12,9) 

188 LET AS(1)="JANUARY " 

118 LET AS(2)="FEBRUARY " 


JO Ul 5 Ne 


Ed P) ma n 
Qe yg 


BD 
a um 


128 LET AS(3)="MARCH 2 
159 LET AS(4)="APRIL d 
148 LET A$(5)="MAY . 
159 LET A$(6)z*JUNE " 
168 LET AS(7)="JULY 2 


178 LET AS(8)="AUGUST i 
188 LET A$(9)-"SEPTEMBER" 
1928 LET AS$(1g)-"OCTOBER " 
280 LET AS(11)="NOVEMBER " 
218 LET AS(12)="DECEMBER " 
228 DIM A(42) 

238 LET END=39 


PAGE 4 


249 IF M=1 OR M=3 OR M=5 OR M=? OR M=8 OR M=1@ OR M=12 THEN LET 
END=31 

258 IF M=2 THEN LET END =28 

268 LET LEAP=3 

220 IFY/4=INT (Y/4) AND Y/1@@<>INT (Y/19@) THEN LET LEAP=1 
288 IF Y/489-INT (Y/408) THEN LET LEAP-1 

389 IF M-2 AND LEAP-1 THEN LET END=29 

319 IF M-1 OR M-2 THEN LET M-M*12 

328 IF M=13 OR M=14 THEN LET Y=Y-1 

S38 LET R-D*2XM*2*INT ((3%M+3)/5)+INT (Y/4) *Y-INT (Y/19@) «INT 
(Y/4ag88) 

346 LET NUM -(R/7-INT (R/2))X7 

359 LET NUM -INT {NUM+ .5) 

369 LET START = NUM 

378 IF NUM=@ THEN LET START=? 

389 LET DAY =1 

398 FOR P=START TO 42 

482 LET AtP)=DAY 

418 LET DAY-DAY*1 

4280 NEXT P 


438 CLS 
449 PRINT TAB 1@3AS(MON);" ";YEAR 
458 PRINT,," SUN MON TUE WED THU FRI SAT" 


478 FOR R=8T05 

488 FOR C=1+R¥? TO 7+R¥? 

498 LET CC=C-R¥? 

S8 IF AtC)=@ THEM PRINT TAB (4XCC);" "3 
S18 IF A‘C}=@ THEN GOTO 559 

S26 IF A(C) > END THEN PRINT TAB (4XCC);" "; 
538 IF AIC) > END THAN GOTO 558 

244 PRINT TAB (4XCC);4A(C); &: 
558 NEXT C = 
568 NEXT R 

578 IF P$="1" THEN COPY 

S88 IF P4="1" THEN GOTO 1 


S98 SLOW 

629 PRINT AT 21,25 "PRESS ANY KEY FOR ANOTHER MONTH" 
618 IF INKEY$="" THEM GOTO 618 

628 GOTO 1 


MACHINE CODE PROGRAMMING 


On the last page you will find several piecs of information about 
the 2-88 chip which is the chip used in the ZX-81. They are all 
grouped in order that you may see the correlation between common M/C 
commands. There are few more things to learn before we can actually 
begin programming a game (or anything) in M/C. s 


As you learned in the last issue of our Newsletter, you can print 
any printable character to the screen by calling a special Print 
Routine within the Z-38 commands. This is fine for printing messages 
but it will not work for moving graphics around on the screen. There 
is another way and it, too, can be used to print messages but is more 
cumbersome and would take a great deal more patience and bytes. 


p. 


PAGE 5 


Mr. Sinclair set up the ZX-81 so that 2 special addresses hold 
the location of the Display File (or D-File in the manual). In some 
computers, the display file is MEMORY MAPPED which means that always 
and forever, the same addresses hold the location of the screen 
positions. For example, in memory mapped computers, the display file 
may begin at location 29889 onwards to a total of the number of print 
positions on the screen. If you wanted to print the letter "A" in the 
middle of the screen, then you would add the number of characters 
across (in the ZX-81 it is 32) times the number of rows down. In the 
ZX-81, the middle is about 19 lines down. Therefore, you would add 
19*32 or 329 to 2988 to print the letter "A" in the middle. But not so 
with the ZX-81. As I stated above, the ZX-81 is NOT memory mapped but 
floats around in memory and since it is a "floater", it is a "SYS7£4^ 
VARIABLE". If you check your manual on the System Variables, you 
will find that the addresses 16396 and 16397 hold the location of the 
beginning of the display file. If we PEEK these addresses at different 
times during programming, you will find that they are different each 
time. In actual fact, we don’t really care where the D-File is 
located; all we want to do is print a character somewhere on the 
screen but in a place decided by us. (Which means doing some 
mathematics). 


Ch yes, there is one more hitch in the floating D-File; at the 
beginning, there is always a character code of 118 and at the end of 
each line, there is a code of 118 which means that each line (except 
the first line) has actually 33 spaces instead of the normally 32 we 
have been accustomed to. We must take this into consideration each 
time we print something to the screen or check the character of what's 
on a particular screen location. Try this: 


FRINT PEEK 16396 + 256 X PEEK 16397. 


This will give you tke address location of the start of D-File. 
If, for example, vou PEEKed the above addresses and the result was 
22080; FRINT PEEK 226869 and you will get 118 which means the start of 
D-File. 


Enter this short program to check how D-File works: 


18 CLS 

28 PRINT "A" 

38 LET X=PEEK 16396 + 256 X PEEK 16397 
48 LET X=Xti 

59 PRINT X 


RUN 


Running through the program, the screen is cleared and the letter 
"A" is printed at the top left corner. In line 39, "X" is the address 
of the beginning of the location of the display file. Since the first 
location is always code 118, in line 42 we add 1 to the address to get 
the first location of the printable part of the D-File. In line 59, we 
PEEK this address contained in "X" which will be code 38. If you check 
in your manual, the code tor 38 is the letter "A". 


— 


PAGE 6 


You should now see how this address holds the location of D-File 
and the fact that we let the computer look after the actual location. 
We don’t really need to know where the D-File is located in memory but 
simply PEEK the variable addresses 16396 and 16397 to find it. 


Now, it we can PEEK these addresses, we can also POKE a printable 
character into the D-File location. Don’t forget, we don’t POKE into 
She addresses 16396 k 16397 but only into their PEEK value. 

Therefore, let’s modify the above program slightly to POKE the 
letter "B" into the top left corner of our screen: 

DELETE LINE 18 

aa POKE X,39 


The letter "E" will have appeared at the top left corner of the 
screen. The whole program above is in Basic so is rather slow but if 
it is done in machine language, it is done very quickly. In fact, it 
moves zo fast that we will actually slow the routine down by about 
198888 cycles in order that we can use the routine in a game!!! Notice, 
128869 cycles. That's like using in Basic: 


FOR I = 1 TA 19889 
NEXT I 


I showed you this routine before but now you should see the logic 
+, First of all, we find the start of the loaction of D-File, then 
POKE a character code into-it, add 1 to the address, go back and do it 
again. The big thing about this program is that it will crash and you 
have to unplug your computer to get out nf it since it doesn't take 
into account all codes 118 and the end of D-File; in fact it will go 
on forever POKEing the codes into memory. All I'm trying to show you 
is how fast this routine is in comparison to the previous machine code 
printing routine. But, this routine is used the most in machine 
language programming. There is one thing more to remember and it is 
important: the register HL must be used whenever the above routine is 
being used and normally DE is used to hold the screen position. (e.g. 
the ZX-81 has Z2 horizontal positions by 24 vertical positions or 768 
possibie positions that can be displayed on the screen. 


Enter a REM line with 12 characters then enter the following 
codes: ' i 


ig REM 123456789812 


42, 12, 64 :LD HL (16396) 
2. da. Ø :LD DE, 1 

25 : ADD HL,DE 

54, 38 SLD (HL), 38 

35 INC HL 

24, 251 JR -5 


PAND USR 16514 


PAGE 7 


Immediately the screen was filled with the letter "A" - so fast - 
that vou were unable to see the start or finish. Mis 


= The last area at the Present time before Starting our "Space 
Game" is that of K-Scan or keyboard scan routine. We must be able to 
control our "Lasers" or the "Spaceship’s" movements and in order to do 


this, we must be able to use the keyboard, obviously. 


There are many subroutines in ROM that we make extensive use of 
which means we don’t "REWRITE" the ROM routines and one of the. 
routines is K-Scan. When we call this routine tin machine language: 
CALL 688), it returns with the value of the last key pressed in the HL 
register, If we Compare the values we are looking for with the values 
in the HL register, we can do something and if the values are not what 
we want, then do nothing. For example, if we wish to have the "Y" key 
to move our Spaceship up, we compare the value in the HL register pair 
to the value of the letter "y", 


Note: it is NOT the character value of "Y" but the keyboard 
section where the letter "Y" is contained. If you have a copy of Toni 
Baker's book "Mastering Machine Code On Your ZX-81" (an excellent book 
on machine code), beginning on page 88, she shows you what the 
sections are about. Basically, the keyboard is divided up into several 
sections (hardware and software). : 

The ton row of key is one section; the next another section, etc. 
Then the sections are divided vertically as well beginning with 1, 8, 
A and SHIFT. This is a very brief explanation of it and if anyone has 
added an external keyboard, this was actually done in hardware. 
According to Toni Baker’s book, we can use „hole sections to move the 
spaceship. For example, the keys 1, 2, and 3 could be one type of 
movement. But if we wanted to get specitic and have only the key 
labelled 1 to do something, then we must examine both the "H" and the 
"L" of the hl register pair. In the above sections, we need only to 
compare the "L" register. 


I*'11 let you find out what the returned value is of each key 
pressed in the following Basic program. You can print them out for 


yourself or jot them down somewhere. Generally, you will only be 
concerned with 5 specific keys for most games: the left, right, up, 
and down movements and = fire-the-missile key. 

18 SCROLL 

28 IF INKEYE = "" THEN GOTO 2£ 


39 LET X = PEEK 16421 

46 LET Y = PEEK 16422 

56 LET AE = INKEYE 

68 PRINT At;": LORYTE="5%, "HIBYTE-";Y 
28 GOTO 19 


What happens in the above program is that the "LOBYTE" will be 
what is returned in the "L" register and the "HIBYTE" will be what is 
returned in the "H" register. In machine Code, you would CALL K-SCAN 
and then compare the HL register with what your expected results would 


See 


PAGE 8 
be and then continue execution of the machine code program 


Well that’s it for this Newsletter for Machine Code programming. 
In the next issue, we will begin to actually program a Space Invaders 
game. 


Since there are several new members in our club since we first 
began our Newsletters, I thought evry once in awhile I would print an 
article #rom some of our first Newsletters. Here then is an article by 
one of former members and very active participant (those of us that 
knew him): 


A SHORT PROGRAM IN FORTH (ZX FORTH) 
by J.J. Castillos 


If you are like me, you got your copy of ZX FORTH, loaded it, 
played a bit with it and after realizing how different it was from 
Basic, you put it away for awhile. Just now I am beginning to grasp 
the elementary notions of FORTH programming and I would like to share 
with you a short program which shows some simple graphic and printing 
routines (each # represents one blank space). Compare the speed of 
execution with a similar BASIC program, or example, any one of the 
Basic games you may have which starts by drawing a black border aroubd 
the screen. 


G 24 1 DO CR ."Hü" 128 EMIT ."HHSHHHHHEHUHUHUHHHHHHHHHHHHHHNMHH" 126 
MIT LOOP 5 NEWLINE  !note: that's 39 spaces! 

A. "48" 31.8 DO 128 EMIT LOOP ; NEWLINE 

M 18 1 DO CR LOOP ; NEWLINE 

E ."##" 128 EMIT ."HHHHTHIS IS A DEMONSTRATION" CR CR ; NEWLINE 

S ."#8#" 128 EMIT ."HHHHHOF FORTH GRAPHICS..." CR CR ; NEWLINE 

X ."HüH" 128 EMIT ."HHHHHHHHHHHHHH" | NEWLINE 'note: 14 spaces! 


s» om ss e» we [T] os 


After making the above definitions exactly as listed, you can run 
the program by entering the following list of words: 


TASK G A HOME A M E X Newline 
and see what happens. Remember that after the laborious entering of 


the definitions, these stay in memory and are added to your 
Vocabulary. The actual program is the last short line of words. 


Priated in Canada by Triuae Printing Copyright (C? 1964 


The Z80 has eight directly accessible 8 bit registers, A,B,C, 
D,E,F,H and L, and four sixteen bit registers IX, IY, the stack pointer SP 
and the programme counter PC. The eight 8 bit registers are sometimes used 
as four sixteen bit registers AF ,BC ,DE,HL. A is the accumulator, F holds 
flags and HL is used to point to an address in memory. 

In the following n is a single byte number, nn is a two byte number, d is 
a displacement and (nn) is the contents of memory location nn e.g (HL) is the 
contents of the address held in HL. P 


1 Load 

Mnemonic LD. Example LD A,C- copy the contents of C into A. 

1.1 8 bit register to register e.gLDA,C 

The contents of any of the registers A,B,C,D,E,H,L may be copied one to 
another. 

1.2 8 bit memory to register e.g LD A, (HL) 

(HL), (IX+d) or (IY+d), may be copied to any of the registers A,B,C,D,E, 
H,L. (BC), (DE) or (nn) may be copied to A. 

1.3 8 bit register to memo: e.g LD (HL), A 

A,B,C,D,E,H,L may be copied to (HL), (IX+d), (IY+d). A may be copied 
to (BC), (DE) or (nn). 3 ; 

1.4 8 bit register or memory immediate e.g LDA, n 

A value n may be loaded into A,B,C,D,E,H,L, (HL), (IX+d), (IY«d). 

1.5 16 bit register to register e.g LD SP, HL 

The contents of HL, IX or IY may be copied to SP. 


1.6 16 bit memory to register e.g LD BC, (nn) 
(nn) may be copied to BC, DE, HL, IX, IY, SP. 


1.7 16 bit register to memory e.g LD (nn), BC 


BC, DE, HL, IX, IY, SP may be copied to (nn) 


1.8 16 bit register imrnediate e.g LD BC, nn 


nn may be loaded into BC, DE, HL, IX, IY, SP 


2 Push and Pop e.g PUSH HL POP HL 

A PUSH instruction copies the contents of a named 16 register to the bottom 
of the stack and decrements the stack pointer twice. A POP instruction does 
the reverse. AF,BC,DE,HL,IX,IY may be PUSHed or POPped. 


3 Exchange e.g EX AF AF' 


An exchange instruction swops the contents of the named pair of 16 bit 
registers or memory locations. In the case of EX and EXX the contents are 
swopped with an otherwise inaccessible set of duplicate registers. Exchanges 
can be made between HL and DE, HL and (SP), (SP) and IX,(SP) and IY, 

AF and AF', BCDEHL and BCDEHL' . 


4 8 bit add and subtract e.g ADD A,E SBC A,D 
A,B,C,D,E,H,L, (HL) ,n, (IX«d) , (IY+d) may be added or subtracted to or 
from the accumulator with or without the carry flag. 


S 8 bit AND OR and XOR e.g ANDC f 
A,B,C,D,E,H,L,(HL),n, (IX+d), (IY+d) may be combined with the accumulator 
using any of the three logical operators above. 


6_Compare e.g CP C 
Compare is like subtract except the flags only and not the contents of the 


accumulator are affected. A,B,C,D,E,H,L, (HL) ,n (IX«d), (IY+d) may be 
compäred with the accumulator. 


7 8 bit increment and decrement e.g INC B 
A,B,C,D,E,H,L,(HL), (IX+d), (IY+d) may be incremented or decremented. 


8 16 bit increment and decrement e.g INC BC 
BC ,DE,HL,IX,IY,SP may be incremented or decremented. 


9 16 bit add and subtract e.g: ADD HL, BC 

BC ‚DE,HL,IX may be added with or without carry or subtracted with carry only 
to or from HL. BC,DE,SP,IX may be added without carry to IX. BC,DE,SP, 

IY may be added without carry to IY. 


10 Jump, call and return 


The flag register, F, contains a carry flag, C, which is set on carry, 
a parity flag P, which is set if a result is even, a sign flag, S, which is set if 
a result is negative, an overflow flag, V, which is set on overflow, and a 
zero flag, Z, which is set on zero. These flags can be used to control jumps, 
subroutine calls and returns. 
10.1 Jump e.g JP NC, nn 

The following jumps to an address nn are possible: absolute jump (JP); 
jump on zero or not zero (JP Z and JP NZ); jump on carry or not carry 
(JP C and JP NC); jump on positive or negative (JP P and JP M); jump on 
P/V = 1 or P/V =0 (JP PE and JP PO). The following relative jumps to an. 
address d relative to the current position are available where d is interpreted 
as lying in the range - 128 to 127: absolute relative jump (JR); relative 
jump on zero or not zero (JR Z or JR NZ); relative jump on carry or not 
carry (JR C and JR NC). Jumps may be made to the addresses held in 
HL,IX or IY. (JP (HL) , JP(IX), JP(IY)). The DJNZ instruction decrements 
the B register and jumps to d if B is non zero. 
10.2 Cal e.g Call Z nn 
If the call condition is met the current contents of the programme counter is 
PUSHed on to the stack and a jump is made to address nn. The following 
calls may be made: absolute call (CALL); call on zero or not zero (CALL Z 
or CALL NZ); call on carry or not carry (CALL C or CALL NC); call on 
positive or negative (CALL P or CALL M); call on P/V = 1 or P/V =0 
(CALL PE or CALL PO). 
10.3 Return e.g RET PO 
If the return condition is met the value in the stack is POPped into the 
programme counter causing a jump back to the position following the previous 
call. Return conditions are available to match each call condition. 
Returns can also be made from the interrupt and the non-maskable interrupt 
(RETI and RETN) 


11 Bit instructions 

The eight bits in each register are numbered from 0 to 7 inclusive from right 
to left. Each of the following operations may be performed on the A,B,C,D, 
E,H,L registers and on (HL), (IX+d) and (IY+d). 


11.1 Bit test e.g BIT 2, B 

The bit test instruction sets the zero flag to the opposite of the named bit. 
Any bit may be tested. 

11.2 Bit set e.g SET 5, D 

Any bit may be set. 

11.3 Bit reset e.g RES 7, H 

Any bit may be reset. 

11.4 Rotate left e.g RL B 

Bit 7 is copied to the carry, the carry is copied to bit O and all other bits 
are copied one place to the left. 

11.5 Rotate right e.g RR D 

Bit O is copied to the carry, the carry is copied to bit 7 and all other bits 
are copied one place to the right. 

11.6 Rotate left circular e.g RLC E A 

Bit 7 is copied to the carry and to bit O. All other bits are copied one place 
to the left. i 

11.7 Rotate right circular e.g RRC A 

Bit O is copied to the carry and to bit 7. All other bits are copied one place 
to the right. 

11.8 Shift left arithmetic e.g SLA (HL) 

AL bits are copied one place to the left, bit 7 is copied to the carry and bit O 
is reset. : 

11.9 Shift right arithmetic e.g SRA A 

All bits are copied one place to the right, bit O is copied to the carry and 
bit 7 is copied to itself. 

11.10 Shift right logical e.g SRL (IX+d) 

As shift right arithmetic but with bit 7 reset. 

11.11 Rotate left digit and rotate right digit e.g RLD 

In a rotate left bits O to 3 of A are copied to bits O to 3 of (HL); bits O to 3 
of (HL) are copied to bits 4 to 7 of (HL); bits 4 to 7 of (HL) are copied to bits ~ 
O to 3of A. i 


12 Accumulator operations 
12.1 Complement accumulator CPL i 
Every set bit is reset, every reset bit is set. 


12.2 Negate accumulator NEG 


Complement and add one. 

12.3 Complement or set carry CCF or SCF 

CCF complements the carry; SCF sets the carry. 
12.4 Decimal adjust DAA 

Corrects the results of BCD addition and subtraction. 


13 Restart e.g RST 20 


Save the programme counter on the stack and jump to location 8*nH where 
nH is the number in hexa decimal. 


14 Block handling e.g LDI ; 
LDI: Move one byte from (DE) to (HL) and decrement BC. LDIR: As 


LDI but repeat until BC = 0. E 
LDD: Move one byte from (DE) to (HL) and decrement'BC, DE and HL. 
LDDR: As LDD but repeat until BC=0. . 

CPI: Compare A and (HL), increment HL and decrement BC. CPIR: As CPI 
but repeat until BC = 0. CPD: As CPI but decrement HL. CPDR: As CPD but 


repeat until BC = 0. 


15 Flip - floj e.g DI 
DI: reset interrupt flip - flop. 


El: set interrupt flip - flop. 


(p*XI)'4 19S up bse 
(prxı)'9 L3S  94P 947 
(P*XI)'S LUS AP BEZ 
(PrxI)'# LIS  93P OLT 
(p+xı)'e 135  3dP ZZZ 
(P+XI)‘Z 135 9AP Pie 
(P*XI)'Il LaS GOP 907 
(P*x1)'O LS 92P 861 
(PrXxI)'2 SU, GAP OGT 
(PrxI)'9 Sri  98P ZBT 
(P*XI)'s sm AVP PLT 
(P*XD'vr sau 9vP 991 
(P*XI)'t SJU  36P 8GI 
(P+X1)‘@ SSH — 96P OSI 
(P*XI)'lS34  38P ZI 
(P+X1)f0 SM  98P BEL 
(prxi)'.ıa ILP 921 
(P+X1)°9 118  94P BILL 
(P*XI)'S LIB — 39P OLL 
(P*XI)'v LIH  99P ZOL 
(P*XI)'t Ld — 3SP #6 
(prxi)'z Lid 9cp — 98 
(pexr)'rii BP 8 
(P+XI)*O LIE 9bP 02 
(p*xi) URS SEP 29 
(P*XI) VHS ZP 9 
(P+XI) vis 92P 8€ 
(P*XI) ui JIP OE 
(P+X1) Tl 91P Zz 
(P*XI) OWN — 30P Pi 
(P*XI) DTU — 90P 9 


2409 dO X3JH 23d 


*Mo[eq pesn 

st Aquo XI ÁRT 104 
* 13151691 A] ey) oF 
Gurilajai ueu^ (£02 
ese Teurtoop) 49 dd 
10 19151631 XI eu oi 
6ul119f21 UIUM (EOZ 
lez ewp) 82 dd 
Aq pepeoeud st sapoo 
GUTMOLTOJ eq jo 4323 


SUOHINNSU! 914q 9a1uL 


xi'ds 47 64i 6t 
(XI) d£ 63 ttt 

XI HSNd S3 677 
XI‘ (dS) X3 £3 Lee 
XI dOd t Sec 


(P+X1) dd pag 061 
(P*XI)uO  P98 28L 
(P+X1) OX PAV VÄI 
(P+XI) ANV  P9V 991 
(PrXxI)'v O8S  P36 8SI 
(P*XI1)8nS P96 OST 
(p*xD'vodv P838 Zul 
(P*XI'V GAV P98 FEL 
(PXD VaT Ps4 921 
V'(P*XI) GT Ped 611 
T (PIXI AT PSL LIL 
H‘ (P+XI) AT Pht 911 
3'(P*XI) AT PE? SII 
a‘(Pp+xI)qT pel FII 
O'(P*XI) di PIL EI 
S'(P*XI) GT POL ZHI 
(P*XI)'1qd1 P39 OTI 
(P+XI)' HAT, P99 ZOT 
(pr*xr)'3d1 Pas #6 
(prxI)'aaT PIS 98 
(P+XI)‘O G1 Psp 82 
(P+X1)'8 qT PIF OL 
ds‘ XI dav 66 2s 
u‘(p+xI) 41 Up9E +S 
(prxI) 234. PSE £S 
(P*XI) ONI PRE ZS 
XI 234 az € 
(uu)*XL AT uuy? Zp 
XI XI dav 62 t 
XI ONI EZ S£ 

XI (uu) AT uuez — vt 
uu'x[ GT UUI? £E 
ga‘ xl dav 61 s 
oa‘ XI aav 60 6 


2409 d0 XIH 94d 


"MOT24 

pasn st AJUO x] Áe 
104 *seystfer AI ou 

01 Õull19f21 uaym (ESZ 
peuir2ep) Gy 10 19IST631 
XI eM 03 Burıısyau 
ueu^ (122 ewp) dd 
Aq pepezeud st sapod 
ÕurMOITOF eui Jo ydeg 


*umoys st Aquo dno16 yore 


Jo 1sı17 eu AQuanbasqns mq Araimua stay ut 
PASH 91? 20 82 % 00 82. pue Lp 01 OF Sepod do 


` *3 0} 19491 Te g 10 y'4*9*c*y«u 919g 
gu pue gu 110] 243 JO sapod do ejdurexe 104 
*ayeridoidde se pueiado 10 92Jnos eui se y* (1H) 

tqt H* a* c! 5* g aouanbas ay ur ıxau ay) asn dnos 

yore ut sapoo do SAIssaaang "14619 jo sdno16 ou! 
Aireanyeu [183 (SSZ EOZ 01 0 gOz Teur2op) 44 99 01 

00 99 Pu? (161 0} p9 Tewr9ap) 4g 01 0p Sapo> do 


uddd 68 Set 
car sa Fel 

dido ta L4 

uat OG GLI 

ddd 6V 691 

dd1' 8V 891 

Ido EV 191 

Id1 OV 091 
(uu)'asq1 tugi EZI 
dS‘ TH Dav VL £l 
ds* (uu) qT uug4 SIT 
dS*1H 28S Zi FU 
ata 39 LIL 

1H'1H OAY V9 901 
qui 19 EOT 

1H'1H 28S 29 86 
uva daS S6 
(uu)*ša q1 was 16 
aa‘IH Sav vs 06 
I'v qi zs 48 
ga‘(uu) q1 wues £8 
ga‘ 1H 28s es 28 
vu dt db 64 
ls db 4 
(uu)'og qI uugp SZ 
og'dH IAV ve bl 
wid AP TE 
NIJ Sv 69 

DIN be 89 

og‘ (uu) q1 uugp 29 
Da‘ TH 245 ze 99 


240940 XIH 244 
“(ŁEZ ewp) aq 
Áq pepeoeud st sepoo 
GUIMOLIOJ eq JO u»e3 
8'4 Las 94 BZ 
8'9 Las 04 OFZ 
8's Las 93 ctc 


09 dO X3H 234 


ge‘ Las Od vec 
ae Las 8a 917 
e'z ids od 802 
att Las 82 002 
80135 09 261 
g8'4 SM sa #81 
g*9 SW og 941 
as sa sv 891 
dr SII Ov O9I 
8't sau 86 ZSI 
g'z sm 06 vl 
att sau 88 GEI 
10 sa 08 821 
‘z Lid 84 081 
a‘9 Lid OL cH 
a*s Lid 89 FOI 
g'y Lid 09 96 
8'£ Lid 8S 88 
‘z Lid os 08 
a‘ Lia 8} 2 
8'0 LIH OP 9 
g TuS g£ 95 

8 VIS sz 0% 
8 vis 02 et 
au 81 bz 


a Tä or 91 

8 Oud 80 8 

v Om 20 L 
(TH). ITA 90 9 
TOT so S 

H OTi T0 L4 

3 ITA to € 

a ITA zo z 

2 ITU 10 i 

8 Im 00 0 


240940 X3H 294 


(£02 reuroep) a5 
Áq papa>sıd st sapoa 
Bur^o[[oj 241 jo u2e3 


HIE LSU 
udo 

AM^O[9q 295 
uu“ TIVO 
I3 

uut iW df 
IH‘dS GT 

. WIN 
HOE LSU 
uuo 

4v HSnd 
uu‘d TIVO 
Id 

uu‘d df 

dv dOd 

d IH 

H8Z ISU 

u HOX 
AO[sq 99s 
uu‘ 34 TIVO 
TH‘ ad X3 
uu’ 3d df 
(1H) df 

"d LH 

HOZ LSU 

u NV 

TH HSNd 
uu'od TIVO 
TH (dS) X3 
uu‘ Od df 
TH dOd 

Od IM 

H8I LSU 
uw Das 
mMo[ag eos 
uu‘ o TIVO 
V NI 

uuto df 
xx3 

2 LII 

HOT LSU 

u gns 

ad HSNd 
uu“ IN TIVO 
v LAO 

uu‘ ON df 
ad dOd 

ON 138 

H8 ISU 

uty Dav 


2409 dO 


08 zZz 


udo 


X3H 


sse 
bse 
ESZ 
ese 
152 
ose 
[274 
Bre 
Loz 
9p? 
ste 
bbe 
EZ 
[474 
lec 
Ove 
6€7 
gez 
Lee 
gez 
Stc 
vec 
EEZ 
Zez 
Tec 
oez 
672 
8322 
127 
977 
Scc 
vec 
EZZ 
eec 
Tez 
ozz 
612 
gIZ 
LIZ 
91c 
sız 
vic 
tic 
eie 
112 
orz 
602 
802 
402 
90€ 


234 


uu TIVO 
uu'z TIVO 
Moaq 295 
uu'z df 
LR 

Z 134 

HO LSU 
uty aay 
28 HSAd 
uut ZN TIVO 
uu df 

uut ZN df 
28 dod 
ZN LI 
add 

ayo 

8 yOx 

8 ANY 
a‘ y ogs 

a ans 

a‘v oav 
atv dav 
av 471 

4° (TH) 47 
BST CET 
8'H 471 
4*3 471 
a‘a aī 
a*3 47 
via ai 
(1H) ‘a G1 
adi 
H*8 AT 
aʻa dt 
a‘ at 
ofa dT 
a‘a dt 
499 

uty aT 

v 23d 

v ONI 

ds 23d 
(uu)'v 471 
dS'1H Gav 
POUL 
42S 

u‘ (TH) AT 
(1H) 234 
(1H) ONT 
dS ONI 


3409 dO 


wud) 
uu)j 
82 
uuy) 
62 
82 
13 
u99 
sd 
uupo 
uugo 
wur) 
12 
02 
ga 
oa 
8v 
ov 
86 

06 

88 
08 
84 
OL 
89 
09 
85 
os 
8 
Ly 

9v 
Sb 
dr 
er 
z} 
t} 

OF 
ae 
uge 


ae 


DE 
8t 
uuvt 
6t 
PSE 
LE 
use 
st 
vt 

£t 


X3H 


v*(uu) aT 
uu*dS AT 
PON UC 
143 

uST dt 
123a 
TONI 

1H 23d 
(uu)*TH GT 
TH‘ 1H Gav 
peZ ur 
vva 

u*H q1 

H 244 

H ONI 

TH ONI 
TH‘ (uu) GT 
uu‘1H GT 
PZN ar 
vau 

u*a 41 

a 234 

3 ONI 

ga 23d 
(aa)'v a1 
gq‘ 1H adv 
Pur 

vH 

uʻa qi 

a oad 

q ONI 

3, ONI 

v‘ (aa) a1 
uu‘ 3d 471 
P ZNra 
vou 
u*5qi 

2 23d 

2 ONI 

o8 23d 
(o8)'v dT 
o8'1H Gav 
Aa X3 
vom 

u'g aī 

8 oad 

A ONI 

28 ONI 
v‘(98) a1 
uu‘ 5g dT 
dON 


2403 dO 


uuze 
uuIe 
POE 
de 
usc 
ac 
IE 
gc 
uuvz 
6c 
P8Z 
LE 
ugg 
Sc 
vc 
tc 
uuzz 
uulz 
poc 
at 
ual 
at 
IT 
8t 
VI 
6t 
PST 
Lt 
ugg 
SI 
ri 
£t 
et 
uurt 
POT 
40 
udo 
ao 
20 
ao 
vo 
60 
80 
20 
u90 
so 
+0 
£0 
co 
uuo 
00 


X3H 


os 
6% 
8b 
Lb 
9v 
Sy 
bP 
er 
ev 
iv 
Ob 
6€ 
8t 
LE 
9€ 
SE 
vt 
£t 
et 
Te 
ot 
6c 
8c 
Le 
97 
se 
vc 
£z 


ec 


de 
N 


e 
N 


Ormnintwnonron 
“Armenien 


OcmwNowoornrwoo 


oaa